package com.yc.javaee.tomcat.impl;

import com.yc.javaee.tomcat.HttpServletRequest;
import com.yc.javaee.tomcat.HttpServletResponse;
import com.yc.javaee.tomcat.ServletException;

import javax.servlet.annotation.WebServlet;
import java.io.IOException;

@WebServlet("/logout.s")
public class LogoutServlet extends HttpServletImpl{
    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        request.getSession().removeAttribute("loginedUser");
        // 退出不使用 ajax json 返回, 使用响应重写
        response.sendRedirect("index.html");
    }
}
